package com.zwy.springinner.listener;

import com.zwy.springinner.event.AbstractEvent;
import lombok.SneakyThrows;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
public class AbstractEventListener implements ApplicationListener<AbstractEvent> {

    @SneakyThrows
    @Override
    @Async
    public void onApplicationEvent(AbstractEvent event) {
        event.execute();
    }
}
